This invention relates generally to the field of computer systems and, more specifically, to computer graphic subsystems.
In all digital playback systems, a key component is the conversion of pixels represented in the YUV, or luminance-chrominance color space to a value in the RGB, or Red-Green-Blue color space. The YUV pixels are those that are typically provided via an external video device such as a video camera, video tape player, etc. Digital Video is often stored with some form of data compression; video decompression processors will most often output data in YUV format. The pixels represented in the RGB format are used to display images on a display device, such as a computer monitor, etc.
Efficiency is critical for the translation operation because it must be executed for each input video pixel; speed enhancements at this stage of operation can therefore provide a dramatic improvement on the performance of the overall video system.
However, the translation between the two types of pixel format is not straight forward. Video pixels are essentially always encoded in YUV, with the 3xc3x973 matrix conversion shown below required from RGB:
|Y||0.299 0.587 0.114∥R |
|U|=|1.69 0.311 0.500∥G|
└V┘└0.500xe2x88x920.419 0.081┘└B┘
In the YUV color space, Y is luminance, or achromatic component, and U and V are the chrominance components. In a typical 8 bits per component digital system, the luminance value, or Y, ranges in value from 0 to 255. The U and V chrominance components range in value from xe2x88x92127 to +127. In an 8 bit per component RGB system, each of the R, G, B components range in value from 0 to 255.
When translating the YUV input back to RGB, the inverse transformation, provided below is applied:
|R||1 0VR∥Y|
|G|=|1UG VG∥Uxc3x85
└B┘└1UB0┘└V┘
Where UB, UG, VG, and VR are the only non-zero non-one elements of the matrix. Therefore, in computing the conversion results, the matrix must be solved for each input Y, U and V value. Typically the solution is explicitly performed either in software or hardware. In software, the dematrixing routine is executed for each input Y, U or V value. In hardware, dematrixing chips are used to provide translation for each input Y,U and V pixel. Both methods have drawbacks because the increased complexity takes more compute cycles and thus reduces overall performance. Dematrixing chips are typically complex and use valuable circuit board real-estate.
It would be desirable to provide a method of YUV to RGB translation that would allow for real time translation of input pixels with a minimum of complexity and area.
According to one aspect of the invention, a method and apparatus for providing translation between input YUV pixels and RGB pixels in a 64 bit computer system includes the steps of storing translation data in a memory such that, during operation, when pixels are input to a run-time system, the YUV input pixels may be used to access the tables to provide data to the 64 bit registers. The translation dematrixing process is apportioned into a chrominance stage, a luminance stage and a truncation stage. An optional byte packing stage may also be invoked.
According to a second aspect of the invention, a method of providing the translation data that is stored in the tables includes the steps of calculating, for each value of each component of the first type of YUV data, a correspondence value representative of a relationship between the value of said component of the YUV data and a value of a corresponding component of RGB data. A table is provided for each of the respective Y, U and V components.
With such an arrangement, Yuv data may be translated to RGB data through the use of table lookups and adds to quickly and efficiently provide translated data using a minimum amount of computer cycle time.